package us.icitap.commandcenter.business.ejb.persistence;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@Table(name="DISPATCHER",schema="MPC")
@TableGenerator(name="DISPATCHER_IDS",table="AUTO_IDS",valueColumnName="LAST_ID",initialValue=1, allocationSize=1)
public class Dispatcher implements Serializable{

	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="DISPATCHER_IDS")
	private Integer id;
	@Column
	private String name;
	
	private boolean status = true;
	
	
	@ManyToOne
	@JoinColumn(name="COMMAND_CENTER_ID")
	private CommandCenter commandCenter;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public CommandCenter getCommandCenter() {
		return commandCenter;
	}
	public void setCommandCenter(CommandCenter commandCenter) {
		this.commandCenter = commandCenter;
	}
	public boolean isStatus() {
		return status;
	}
	public void setStatus(boolean status) {
		this.status = status;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Dispatcher other = (Dispatcher) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
}
